package cn.com.longfuinfo.wx.util;

import java.io.Reader;
import java.sql.Clob;

public class ColbUtil {

	public static String colb2String(Object colobObj){
		if (colobObj == null) {
			return "";
		}
		StringBuffer clobString = new StringBuffer();
		if (colobObj instanceof Clob) {
			int y;
			char ac[] = new char[4096];
			Reader reader;
			try{
			reader = ((Clob) colobObj).getCharacterStream();
				while ((y = reader.read(ac, 0, 4096)) != -1) {
					clobString.append(new String(ac, 0, y));
				} 
			}catch (Exception e) {
				e.printStackTrace();
			}
			
		} else {
			clobString.append(colobObj.toString());
		}
		String rtn_str = clobString.toString();
		//System.out.println(rtn_str);
		return rtn_str;
		
	}
}
